<div id="content-header">
    <div id="breadcrumb"> 
    	<a ui-sref="home.company" title="Go to Home" class="tip-bottom">
    		<i class="icon-home"></i> 工作量</a> 
    		<a ui-sref="home.departTasks" class="current">部门添加任务
    	</a> 
    </div>
  </div>
  <div class="col-sm-12 col-md-5" style="padding-top: 50px;width: 100%	;">
	<button ng-click="columnAdd('','add')" class="btn  btn-primary btnheight">添加</button>
	<div class="col-md-13">
		<div id="datatable-buttons_filter" class="dataTables_filter" >
				<label style="float: left;">
					<ui-select ng-model="selectedtype.value">
								    <ui-select-match>
								        <span  ng-bind="$select.selected.diName" ></span>
								    </ui-select-match>
								    <ui-select-choices repeat="item in (typeArray | filter:  $select.search) track by item.diId">
								        <span ng-bind="item.diName"></span>
								    </ui-select-choices>
					</ui-select>
				</label>	
				<label style="float: left;">
					<ui-select ng-model="selected.value">
								    <ui-select-match>
								        <span  ng-bind="$select.selected.diName" ></span>
								    </ui-select-match>
								    <ui-select-choices repeat="item in (itemArray | filter:  $select.search) track by item.diId">
								        <span ng-bind="item.diName"></span>
								    </ui-select-choices>
					</ui-select>
				</label>	
				<label style="float: left;">
					<ui-select ng-model="selectDepart.value">
								    <ui-select-match>
								        <span  ng-bind="$select.selected.diName" ></span>
								    </ui-select-match>
								    <ui-select-choices repeat="item in (staffDepart | filter:$select.search) track by item.diId">
								        <span ng-bind="item.diName"></span>
								    </ui-select-choices>
					</ui-select>
				</label>
			<label style="float: left;">
				<input type="search" ng-model="sumtWorkload" style="width: 100px!important;" class="form-control inputweight" 
					 aria-controls="datatable-buttons" placeholder="小于工作量">
					 <input type="search" ng-model="tWorkload" style="width: 100px!important;" class="form-control inputweight" 
					 aria-controls="datatable-buttons" placeholder="大于工作量">
			</label>
			<label style="float: left;">
				<input type="search" ng-model="tName" class="form-control inputweight" 
					 aria-controls="datatable-buttons" placeholder="关键字">
					<button  class="btn  btn-primary btnheight btn-inquiry" ng-click="search(pageNum)">查询</button>
			</label>
		</div>
	</div>
</div>
  <div class="container-fluid">
    <div class="row-fluid">
      <div class="span12">
 
			<div class="widget-box">
          <div class="widget-content nopadding">
            <table class="table table-bordered data-table">
              <thead>
                <tr>
                  <th width="10%" >任务名称</th>
                   <th width="10%">项目名称</th>
                  <th width="10%">指派人</th>
                  <th width="10%">任务开始时间</th>
                  <th width="10%">任务结束时间</th>
                  <th width="10%">任务工作量</th>
                  <th width="10%">任务类型</th>
                  <th width="10%">状态</th>
                  <th width="20%">操作</th>
                </tr>
              </thead>
              <tbody>
                <tr class="gradeX" bindonce ng-repeat="o in list">
                  <td bo-text="o.tName"></td>
                  <td bo-text="o.tProName"></td>
                    <td bo-text="o.tDesigneeName"></td>
                   <td bo-text="o.tStartTime|dateValue"></td>
                 	 <td bo-text="o.tEndTime|dateValue"></td>
                   <td bo-text="o.tWorkload"></td>
                   <td >
                   	<span ng-if="o.tType==0" class="grend">项目</span>
                   	<span ng-if="o.tType==1" class="blud">维护</span>
                   </td>
                   <td >
                   	<span ng-if="o.tState==0"><img src="img/demo/success.png"/></span>
                   	<span ng-if="o.tState==1"><img src="img/demo/error.png"/></span>
                   </td>
                  <td>
                  	<button ng-click="columnAdd(o.tId,'up')" class="btn  btn-primary">修改</button>
                  	<button ng-click="columnXQ(o.tId,'up')" class="btn  btn-primary">详情</button>
                  	<button class="btn  btn-danger" ng-click="modelClick(o.tId)">删除</button>
                  </td>
                </tr>
                 <tr class="gradeX"  ng-if="totalSize==0||totalSize==undefined"  class="even">
	            	<td colspan="9"> 暂无数据</td>
	           	</tr>
              </tbody>
            </table>
          </div>
        </div>
         <div class="fy" ng-if="totalSize>0">
									<p>共<span>{{totalSize}}</span>条记录，<span>{{pageNum}}</span>/<span>{{totalNum}}</span>页</p>
									<ul uib-pagination 
										first-text="首页" 
										last-text='末页' 
										next-text='下一页' 
										previous-text='上一页' 
										total-items="totalSize" 
										items-per-page='pageSize' 
										boundary-link-numbers='true' 
										max-size='3' boundary-links='true' 
										ng-model="$parent.tj.current" 
										ng-change='search(tj.current)'>
									</ul>
									<p>到第<input placeholder="{{pageNum}}" ng-change="pageUp()" ng-model="$parent.tj.page" />页</p>
									<span ng-click="toPage($parent.tj.page)">前往</span>
			</div>
					
      </div>
    </div>
 </div>
 

<script type="text/ng-template" id="companyXQ.html">
			<style>
				.modal-content{
					width: 600px;
					margin-left: 180px;
				}
				.table_input{
					width:256px;text-indent: .1rem;height: 36px;
				}
				.table_span{
					display: block;width:100px;
				}
				
			</style>
			<div class="modal-header" style="text-align: center;font-size: 24px;background: #4092E8;color: white;height:50px;line-height: 50px">
				<div style="margin-top: -8px;">
					详情
				</div>
				<button style="color:white;float: right;background: #4092e8;border: none;outline: none;box-shadow: none;margin-top: -35px;" class="btn " type="button" ng-click="cancel()">[关闭]</button>
			</div>
			<div class="modal-body" >
				<div class="adduser" >

					<div style="    margin-left: 40px;">
						<form novalidate="novalidate" name="form">
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >任务名称：</span>
								<input class="table_input"    type="text" value="" name="tName" ng-model="param.tName" required>
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >项目名称：</span>
								<input class="table_input"    type="text" value="" ng-model="param.tProName" >
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >指派人员姓名：</span>
								
                    			<input class="table_input"    type="text" value="" name="tName" ng-model="param.tDesigneeName" >
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >添加人姓名：</span>
								
                    			<input class="table_input"    type="text" value="" name="tName" ng-model="param.tCreatePeopleName" >
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >任务开始时间：</span>
								<input class="table_input"    type="text" value="" name="tName" ng-model="param.tStartTime" >
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >任务结束时间：</span>
								<input class="table_input"    type="text" value="" name="tName" ng-model="param.tEndTime" >
							</div>
							
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >任务类型：</span>
								<input class="table_input" ng-if="param.tType==0"   type="text" value="项目" name="tName" />
								<input class="table_input"  ng-if="param.tType==1"   type="text" value="维护" />
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >工作量：</span>
								<input class="table_input"    type="text" value="" name="tWorkload" ng-model="param.tWorkload"  required>
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >状态：</span>
								<input class="table_input" ng-if="param.tState==0"   type="text" value="未完成"  />
								<input class="table_input"  ng-if="param.tState==1"   type="text" value="完成" />
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >详细描述：</span>
								<textarea class="table_input"    type="text" value="" name="cProduct" ng-model="param.tDetail" />
							</div>
							
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >图片：</span>
								<div class="upload">
										<div ng-repeat="f in param.taskImageList">
											<img   ng-src="{{f.tiUrl|imgs}}" ng-click="imgYl(f.tiUrl|imgs)"/>
										</div>
									 	
								</div>
							</div>
							
							
							
						</form>

					</div>
				</div>
			</div>
			<!--<div class="modal-footer" style="position: relative;height:50px;">
				<div style="display: flex;justify-content: flex-end;padding: 0;position: absolute;right: 20px;top: 0.1rem;">
					
					<button  class="" ng-disabled="form.$invalid||param.cType==''" ng-class="{true:'btn btn-primary'}[form.$invalid||param.cType=='']" 
						style="width: 100px;border-radius: 0;line-height: 32px;background-color:#4092e8 ;border:#4092e8 ; font-size: 13px;color: white;font-size: 14px;"
						ng-click="ok(form.$invalid)">保 存</button>
				</div>
			</div>-->
		</script>

<script type="text/ng-template" id="companyAdds.html">
			<style>
				.modal-content{
					width: 600px;
					margin-left: 180px;
				}
				.table_input{
					width:256px;text-indent: .1rem;height: 36px;
				}
				.table_span{
					display: block;width:100px;
				}
				
			</style>
			<div class="modal-header" style="text-align: center;font-size: 24px;background: #4092E8;color: white;height:50px;line-height: 50px">
				<div style="margin-top: -8px;">
					{{sername}}
				</div>
				<button style="color:white;float: right;background: #4092e8;border: none;outline: none;box-shadow: none;margin-top: -35px;" class="btn " type="button" ng-click="cancel()">[关闭]</button>
			</div>
			<div class="modal-body" >
				<div class="adduser" >

					<div style="    margin-left: 40px;">
						<form novalidate="novalidate" name="form">
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >任务名称：</span>
								<input class="table_input"    type="text" value="" name="tName" ng-model="param.tName" required>
								<span class="error bigError "  ng-show="form.tName.$error.required" style="font-size: 18px;font-weight: bold;">*</span>
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >项目名称：</span>
								
								<select  class="table_input"  name="tProId" ng-model="param.tProId"   required
                    			ng-options="o.diId as o.diName for o in typeDic"></select>
                    			<span class="error bigError "  ng-show="form.tProId.$error.required" style="font-size: 18px;font-weight: bold;">*</span>
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >指派人员姓名：</span>
								<select  class="table_input"  name="tDesigneeId" ng-model="param.tDesigneeId"  required 
                    			ng-options="o.diId as o.diName for o in staff"></select>
                    			<span class="error bigError "  ng-show="form.tDesigneeId.$error.required" style="font-size: 18px;font-weight: bold;">*</span>
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >任务开始时间：</span>
								<model-picker class=""  name="pickertime" ng-model="pickertime" required ></model-picker>
								<span class="error bigError "  ng-show="form.pickertime.$error.required" style="font-size: 18px;font-weight: bold;">*</span>
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >任务结束时间：</span>
								<model-pickers class=""  name="pickertimes"  ng-model="pickertimes" required ></model-pickers>
								<span class="error bigError "  ng-show="form.pickertimes.$error.required" style="font-size: 18px;font-weight: bold;">*</span>
							</div>
							
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >任务类型：</span>
								<select  class="table_input"  name="tType" ng-model="param.tType"  required
                    			>
                    			<option value="">请选择</option>
								<option value="0"  ng-selected="param.tType==0">项目</option>
								<option value="1"  ng-selected="param.tType==1">维护</option>
								</select>
                    			<span class="error bigError "  ng-show="form.tType.$error.required" style="font-size: 18px;font-weight: bold;">*</span>
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >工作量：</span>
								<!--<input class="table_input"    type="text" value="" name="tWorkload" ng-model="param.tWorkload" required>
								<span class="error bigError "  ng-show="form.tWorkload.$error.required" style="font-size: 18px;font-weight: bold;">*</span>-->
								<input class="table_input"    type="text" value="" name="tWorkload" ng-model="param.tWorkload"  required>
								<span class="error bigError "  ng-show="form.tWorkload.$error.required" style="font-size: 18px;font-weight: bold;">*</span>
							</div>
							
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >详细描述：</span>
								<textarea class="table_input"    type="text" value="" name="cProduct" ng-model="param.tDetail" />
							</div>
							
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" >图片：</span>
								<form style="display: inline-block;" >
								<div  class="btn  btn-primary"    ngf-select ngf-change="submit()" ng-model="file" name="file" 
									 ngf-max-size="20MB" ngf-min-size="0KB"  ngf-accept="'image/*'" ngf-multiple="true">上传</div>
									 
									 
								
							 </form>
							</div>
							<div style="margin: 10px 0;display: flex;align-items: center;">
								<span class="table_span" ></span>
								<div class="upload">
										<div ng-repeat="f in param.taskImageList">
											 <i class="icon iconfont icon-cheng" ng-click="delimg(f.tiUrl,f)"></i>
											<img   ng-src="{{f.tiUrl|imgs}}" ng-click="imgYl(f.tiUrl|imgs)"/>
										</div>
									 	
								</div>
									 
								
							 </form>
							</div>
							
							
						</form>

					</div>
				</div>
			</div>
			<div class="modal-footer" style="position: relative;height:50px;">
				<div style="display: flex;justify-content: flex-end;padding: 0;position: absolute;right: 20px;top: 0.1rem;">
					
					<button  class="" ng-disabled="form.$invalid||param.cType==''" ng-class="{true:'btn btn-primary'}[form.$invalid||param.cType=='']" 
						style="width: 100px;border-radius: 0;line-height: 32px;background-color:#4092e8 ;border:#4092e8 ; font-size: 13px;color: white;font-size: 14px;"
						ng-click="ok(form.$invalid)">保 存</button>
				</div>
			</div>
		</script>
<style>
	.upload{
		width: 100%;
	}
	.upload>div>img{
		width: 60px;
		height: 60px;
		max-width: 100%;
		max-height: 100%;
		
	}
	.upload>div>i{
		    position: absolute;
		    font-size: 12px;
	}
	.upload>div{
		margin: 5px;
		width: 60px;
		height: 60px;
		float:left
	}
</style>